//- 先去这个pug文件中找
extends shopHead_nav.pug

block append pageStyle
	link(href="${relativePath}/static/css/shopping/shopIndex.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/materFinished.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/service.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/search.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/colleague.css" rel="stylesheet" type="text/css")
	link(href="${relativePath}/static/css/shopping/hot.css" rel="stylesheet" type="text/css")

block matrialContent
	//- 成品材料内容
	div.matrialCon.layout
		div.productsBox
			div.list
				ul
					li
						span.cur 当前位置：
						a(href="javascript:;")
							| 标识汇>
							a(href="./colleague.html") 同行
							| >推荐公司
		ul.tabList
			li.current 浏览量
			li 更新频率
			div.clearfix
		div.hot-box
			//- 浏览量
			div.history.showbox.active
			
			//- 更新频率	
			div.freq.showbox
			div.clearfix

		
	//- 浏览量
	script#history(type="text/html")
		| {{set data = data.companys}}
		| {{each data arr}}
		div.hot-list.fl
			div.leftImg.fl
				img(src="{{arr.company_logo}}")
				//- 工商标志
				| {{if arr.auth =='4'}}
				img.gsicon(src="${relativePath}/static/imgs/gs.png")
				| {{/if}}
			div.right-con.fl
				p.nowrap.com-name 
					| {{arr.name}}
					| {{if arr.leaguer_type ==2}}
					img(src="${relativePath}/static/imgs/zsr.png")
					| {{else if arr.leaguer_type ==1}}
					img(src="${relativePath}/static/imgs/zsb.png")
					| {{else if arr.leaguer_type ==3}}
					img(src="${relativePath}/static/imgs/zsy.png")
					| {{/if}}

				div.center.bottomt
					div.litte.nowrap.years.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   {{arr.year}}年
					div.litte.nowrap.address.fl
						img(src="${relativePath}/static/imgs/po.png")
						|   {{arr.area}}
					div.litte.nowrap.advice.fl
						|  {{arr.ad_market}}
					div.clearfix
				div.center.bottomp
					div.litte.nowrap.phone
						img(src="${relativePath}/static/imgs/phone2.png")  
						|  电话：{{arr.phone}}
				div.btm.hbtm
					| {{set list = arr.tags}}
					| {{each list tag}}
					a(href="javascript:;") {{tag.name}}
					| {{/each}}
				//- 定制下单按钮
				a.mized 定制下单
			div.clearfix
		| {{/each}}
	//- 更新频率列表
	script#freq(type="text/html")
		| {{set data = data.companys}}
		| {{each data arr}}
		div.hot-list.fl
			div.leftImg.fl
				img(src="{{arr.company_logo}}")
				//- 工商标志
				| {{if arr.auth =='4'}}
				img.gsicon(src="${relativePath}/static/imgs/gs.png")
				| {{/if}}
			div.right-con.fl
				p.nowrap.com-name 
					| {{arr.name}}
					| {{if arr.leaguer_type ==2}}
					img(src="${relativePath}/static/imgs/zsr.png")
					| {{else if arr.leaguer_type ==1}}
					img(src="${relativePath}/static/imgs/zsb.png")
					| {{else if arr.leaguer_type ==3}}
					img(src="${relativePath}/static/imgs/zsy.png")
					| {{/if}}

				div.center.bottomt
					div.litte.nowrap.years.fl
						| {{if arr.auth =='4'}}
						img(src="${relativePath}/static/imgs/gsh.png")
						| {{else}}
						img(src="${relativePath}/static/imgs/gsg.png")
						| {{/if}}
						|   {{arr.year}}年
					div.litte.nowrap.address.fl
						img(src="${relativePath}/static/imgs/po.png")
						|   {{arr.area}}
					div.litte.nowrap.advice.fl
						|  {{arr.ad_market}}
					div.clearfix
				div.center.bottomp
					div.litte.nowrap.phone
						img(src="${relativePath}/static/imgs/phone2.png")  
						|  电话：{{arr.phone}}
				div.btm.hbtm
					| {{set list = arr.tags}}
					| {{each list tag}}
					a(href="javascript:;") {{tag.name}}
					| {{/each}}
				//- 定制下单按钮
				a.mized 定制下单
			div.clearfix
		| {{/each}}
	//- 浏览量分页
	div.pageBox.pageBox1
		nav.pageNav
			div.paginationOne.page
	//- 更新频率分页
	div.pageBox.pageBox2
		nav.pageNav
			div.paginationOne.page

block pageScript

	script.
		var MENUNUM
		$(function(){
			$("#colleague").addClass("active");
			$("#cpcl").click(function(){
				window.location.href='materFinished.html';
			});
			$("#hyfw1").click(function(){
				window.location.href='industryServiceIndex.html';
			});
			$("#index").click(function(){
				window.location.href='materIndex.html';
			});
			
			$(".left span").click(function(){
				$(this).addClass("current").siblings().removeClass("current");
			})

			//- 点击切换浏览量和更新频率
			$(".tabList li").click(function() {
				var index = $(this).index()
				if(index==0) {
					$(".pageBox1").show()
					$(".pageBox2").hide()
				}else{
					$(".pageBox2").show()
					$(".pageBox1").hide()
				}
				$(this).addClass('current').siblings().removeClass('current')
				$(".showbox").eq(index).addClass('active').siblings().removeClass('active')
			})
			//- 获取推荐公司列表
			function historyList(sort,pageNum) {
				$.post(shopIp+'/peer/recommendCompany',{
					userToken:token,
					page:pageNum,
					sort_new:sort,
					size:10
				},function(res) {
					if(sort == 1) {
						$('.history').empty()
						var list = res.data
						var hot = template('history',res)
						$('.history').append(hot)
						$(".pageBox1 .page").html("").pagination({
							pageCount : list.total_page,
							current : pageNum,
							keepShowPN : true,
							count : 2,
							homePage : "1",
							endPage : list.total_page,
							coping : true,
							prevContent : "< 上一页",
							nextContent : "下一页 >",
							callback : function(page) {
								historyList(page.getCurrent());
							}
						});
					}else{
						$('.freq').empty()
						var list = res.data
						var hot = template('freq',res)
						$('.freq').append(hot)
						$(".pageBox2 .page").html("").pagination({
							pageCount : list.total_page,
							current : pageNum,
							keepShowPN : true,
							count : 2,
							homePage : "1",
							endPage : list.total_page,
							coping : true,
							prevContent : "< 上一页",
							nextContent : "下一页 >",
							callback : function(page) {
								historyList(page.getCurrent());
							}
						});
					}
					
				})
			}
			historyList(1,1)
			historyList(2,1)
		});